using System;
using System.Data.Entity.ModelConfiguration;
using System.Data.Common;
using System.Data.Entity;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using DomainLayer.Data.Entities;

namespace Infrastructure.Data.Mapping
{
	public class ServiceLogMap : EntityTypeConfiguration<ServiceLog>
	{
		public ServiceLogMap()
		{
			// Primary Key
			this.HasKey(t => t.LogID);

			// Properties
			this.Property(t => t.ServiceName)
				.HasMaxLength(50);
				
			this.Property(t => t.LogType)
				.HasMaxLength(50);
				
			this.Property(t => t.ErrorInfo)
				.HasMaxLength(4000);
				
			this.Property(t => t.SourceData)
				.HasMaxLength(4000);
				
			// Table & Column Mappings
			this.ToTable("ServiceLog");
			this.Property(t => t.LogID).HasColumnName("LogID");
			this.Property(t => t.ServiceName).HasColumnName("ServiceName");
			this.Property(t => t.LogType).HasColumnName("LogType");
			this.Property(t => t.StartTime).HasColumnName("StartTime");
			this.Property(t => t.EndTime).HasColumnName("EndTime");
			this.Property(t => t.CreateTime).HasColumnName("CreateTime");
			this.Property(t => t.WayBillNo).HasColumnName("WayBillNo");
			this.Property(t => t.ErrorInfo).HasColumnName("ErrorInfo");
			this.Property(t => t.SourceData).HasColumnName("SourceData");
			this.Property(t => t.ISDelete).HasColumnName("ISDelete");
			this.Property(t => t.ISHandle).HasColumnName("ISHandle");
		}
	}
}

